import MMWRSettings from "@components/Apps/MMWR/MMWRSettings";
import { ClientMessage } from "@runtime/generate/message/ClientMessage";
import MessageHandler from "@runtime/module/Handler/MessageHandler";

/**
 * 智能网联车辆 - 毫米波雷达 - 基本信息 - 更新
 */
export default class MillimeterWaveRadarBaseInformationUpdateMessageHandler extends MessageHandler<ClientMessage.MillimeterWaveRadarBaseInformationUpdateMessage> {
    protected async RunAsync(message: ClientMessage.MillimeterWaveRadarBaseInformationUpdateMessage): Promise<void> {
        MMWRSettings.Default.BaseInformation.NVMReadStatus = message.Information.NVMReadStatus;
        MMWRSettings.Default.BaseInformation.NVMWriteStatus = message.Information.NVMWriteStatus;
        MMWRSettings.Default.BaseInformation.SensorID = message.Information.SensorID;
        MMWRSettings.Default.BaseInformation.OutputTypeCfg = message.Information.OutputTypeCfg;
        MMWRSettings.Default.BaseInformation.MaxDistanceCfg = message.Information.MaxDistanceCfg;
        MMWRSettings.Default.BaseInformation.RadarPowerCfg = message.Information.RadarPowerCfg;
        MMWRSettings.Default.BaseInformation.SendQualityCfg = message.Information.SendQualityCfg;
        MMWRSettings.Default.BaseInformation.SendExtInfoCfg = message.Information.SendExtInfoCfg;
        MMWRSettings.Default.BaseInformation.CtrlRelayCfg = message.Information.CtrlRelayCfg;
        MMWRSettings.Default.BaseInformation.SortIndex = message.Information.SortIndex;
        MMWRSettings.Default.BaseInformation.RcsThreshold = message.Information.RcsThreshold;
        MMWRSettings.Default.BaseInformation.PersistentError = message.Information.PersistentError;
        MMWRSettings.Default.BaseInformation.TemporaryError = message.Information.TemporaryError;
        MMWRSettings.Default.BaseInformation.Interference = message.Information.Interference;
        MMWRSettings.Default.BaseInformation.TemperatureError = message.Information.TemperatureError;
        MMWRSettings.Default.BaseInformation.VoltageError = message.Information.VoltageError;
        MMWRSettings.Default.BaseInformation.MotionRxState = message.Information.MotionRxState;
    }
}
